package cn.sunshine.ymcc.web.controller;

import cn.sunshine.ymcc.dto.AlipayNotifyDto;
import cn.sunshine.ymcc.service.IPayNotifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pay")
public class PayNotifyController {
    @Autowired
    private IPayNotifyService payNotifyService;

   /*
   * @Title: notify
   * @Description: 支付宝异步通知
   * @Author: Mr.Jiang
   * @Version: 1.0
   * @Date:  2022/8/20 14:06
   * @Parameters: [dto]
   * @Return java.lang.String
   */
    @PostMapping("/alipay/notify")
    public String notify(AlipayNotifyDto alipayNotifyDto){
        try {
            return payNotifyService.sendNotify(alipayNotifyDto);
        } catch (Exception e) {
            e.printStackTrace();
            return "ERROR";
        }

    }
}
